/*
 *  input.c
 *
 *  $Id: input.c 7 2009-08-16 13:27:17Z nramsbottom $	
 *
 */

#include <stdio.h>

#include "input.h"

// wraps a call to fgets and strips trailing carriage return / linefeed
char* input_readline(char* buffer, int max) {
	char* c = buffer;
	if (fgets(buffer, max, stdin)) {
		// strip cr/lf.
		do {
			if (*c == '\r' || *c == '\n') {
				*c = '\0';
				break;
			}
		} while(*++c != '\0');
	}
	return buffer;
} //